﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;

namespace DelegateControlStatistic.CONTROLTEMPLATES
{
    public partial class StatsDelegate : UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            SPUser currentUser = SPContext.Current.Web.CurrentUser;
            if (currentUser != null)
            {
                StatVisitor.Text = String.Format("Alerts:{0} - Groups:{1} - Informations:{2} {3} {4} - Site coll admin:{5} - Contributor currently connected:{6}",
                    currentUser.Alerts.Count,
                    currentUser.Groups.Count,
                    currentUser.LoginName,
                    currentUser.Name,
                    currentUser.Email,
                    currentUser.IsSiteAdmin,
                    SPContext.Current.Web.DoesUserHavePermissions(SPBasePermissions.EditListItems));
            }
        }
    }
}
